package com.thermal.thermal_inspection.service.impl;

import com.thermal.thermal_inspection.entity.Case;
import com.thermal.thermal_inspection.mapper.CaseMapper;
import com.thermal.thermal_inspection.service.CaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CaseServiceImpl implements CaseService {

    @Autowired
    private CaseMapper caseMapper;

    @Override
    public Case getCaseById(int caseId) {
        return caseMapper.selectCaseById(caseId);
    }

    @Override
    public List<Case> getAllCases() {
        return caseMapper.selectAllCases();
    }

    @Override
    public int addCase(Case caseData) {
        return caseMapper.insertCase(caseData);
    }

    @Override
    public boolean updateCase(Case caseData) {
        return caseMapper.updateCase(caseData) > 0;
    }

    @Override
    public boolean deleteCase(int caseId) {
        return caseMapper.deleteCase(caseId) > 0;
    }
    @Override
    public List<Case> searchCases(Integer patientId, Integer doctorId) {
        System.out.println("patientId:"+patientId+"，doctorId:"+doctorId);
        return caseMapper.searchCases(patientId, doctorId);
    }
}

